//
//  EGAarcAssignCell.m
//  EGA_Archives_iOS
//
//  Created by gad on 1/17/56 BE.
//  Copyright (c) 2556 EGA. All rights reserved.
//

#import "EGAarcAssignCell.h"
@implementation EGAarcAssignCell
+(NSArray*)arrayWithJson:(NSData*)jsonData
{
    NSError *error;
    NSMutableArray *result = [[NSMutableArray alloc]init];
    
    NSArray *dataArray = (NSArray*)[NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&error];
    for (int i = 0 ; i < [dataArray count]; i++) {
        NSDictionary *dict = [dataArray objectAtIndex:i];
        
        EGAarcAssignCell *item = [[EGAarcAssignCell alloc]init];
        item.ID = [[dict objectForKey:@"ID"]integerValue];
        item.Doc_FiscalYear =[[dict objectForKey:@"Doc_FiscalYear"]integerValue];
        item.Doc_Register = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_Register"]] ;
        item.Doc_Serial =  [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_Serial"]] ;
        item.Doc_Subject =  [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_Subject"]] ;
        item.Doc_Description = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_Description"]] ;
        item.Doc_date = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_date"]] ;
        item.Doc_ReciveDate = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_ReceiveDate"]] ;
        item.Doc_to = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_to"]] ;
        item.DocToName = [NSString stringWithFormat:@"%@", [dict objectForKey:@"DocToName"]] ;
        item.Doc_Name = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_Name"]] ;
         item.Org_Name = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Org_Name"]] ;
        item.Doc_Priority_ID = [[dict objectForKey:@"Doc_Priority_ID"]integerValue];
        item.Doc_priority_Name = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_priority_Name"]] ;
        item.Doc_Secret_ID = [[dict objectForKey:@"Doc_Secret_ID"]integerValue];
        item.Doc_Status_ID = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_Status_ID"]] ;
        item.Doc_Status_Name = [NSString stringWithFormat:@"%@", [dict objectForKey:@"Doc_Status_Name"]] ;
        item.chkAssign =[[dict objectForKey:@"chkAssign"]integerValue];
        item.empEmail = [NSString stringWithFormat:@"%@", [dict objectForKey:@"empEmail"]] ;
         item.taskDetail = [NSString stringWithFormat:@"%@", [dict objectForKey:@"taskDetail"]] ;
        item.DocPriorityID = [NSString stringWithFormat:@"%@", [dict objectForKey:@"DocPriorityID"]] ;
          item.DocPriorityID = [NSString stringWithFormat:@"%@", [dict objectForKey:@"DocPriorityID"]] ;
          item.startDate = [NSString stringWithFormat:@"%@", [dict objectForKey:@"startDate"]] ;
          item.endDate = [NSString stringWithFormat:@"%@", [dict objectForKey:@"endDate"]] ;
          item.IsDueDate = [NSString stringWithFormat:@"%@", [dict objectForKey:@"IsDueDate"]] ;
        
        item.DocBookBeforeSign_ID = [NSString stringWithFormat:@"%@", [dict objectForKey:@"DocBookBeforeSign_ID"]] ;
        item.DocBookBeforeSign_Name = [NSString stringWithFormat:@"%@", [dict objectForKey:@"DocBookBeforeSign_Name"]] ;
        item.DocAttachment_ID = [NSString stringWithFormat:@"%@", [dict objectForKey:@"DocAttachment_ID"]] ;
        item.DocAttachment_Name = [NSString stringWithFormat:@"%@", [dict objectForKey:@"DocAttachment_Name"]] ;

        
      NSLog(@"item.DocBookBeforeSign_ID::%@",item.DocBookBeforeSign_Name);

        [result addObject:item]; 
      
       // NSLog(@"y%@",item.taskDetail);
    }
    
    //return ([result count]>0)?[NSArray arrayWithArray:result]:nil;
    return ([result count]>0)?result:nil;

   
}

@end
